package com.zb.callback.utils;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * 伙伴云故障明细字段映射工具类
 * @Author WEN
 * @Date 2024/8/29 0029
 **/
@Data
public class HoubanyunFaultDetailFieldMappingUtil {
    @ApiModelProperty(value = "故障明细、原因")
    private static Map<String, String> faultDetailMap;

    @ApiModelProperty(value = "故障原因")
    private String faultReson;

    @ApiModelProperty(value = "故障明细")
    private String faultDetail;

    static {
        // 故障明细
        faultDetailMap = new HashMap<>();
        // 产品质量问题
        faultDetailMap.put("按键异常/数字乱跳", "2300012984682908,2300012207355512");
        faultDetailMap.put("把手松动", "2300012984682911,2300012207355512");
        faultDetailMap.put("报警（异响）", "2300012984682913,2300012207355512");
        faultDetailMap.put("不通电", "2300012984682915,2300012207355512");
        faultDetailMap.put("耗电快", "2300012984682917,2300012207355512");
        faultDetailMap.put("黑屏（功能正常屏幕不亮）", "2300012984682919,2300012207355512");
        faultDetailMap.put("临时密码无法使用", "2300012984682921,2300012207355512");
        faultDetailMap.put("验证成功无法开门", "2300012984682923,2300012207355512");
        faultDetailMap.put("把手空转", "2300012984682940,2300012207355512");
        faultDetailMap.put("锁芯空转", "2300012984682928,2300012207355512");
        faultDetailMap.put("通开", "2300012984682929,2300012207355512");
        faultDetailMap.put("无故提示恢复出厂设置", "2300012984682933,2300012207355512");
        faultDetailMap.put("无声音", "2300012984682937,2300012207355512");
        faultDetailMap.put("指纹异常", "2300012984682940,2300012207355512");
        faultDetailMap.put("产品质量问题-其他", "2300013092925839,2300012207355512");
        faultDetailMap.put("产品质量问题-锁舌不回弹", "2300013615874181,2300012207355512");
        faultDetailMap.put("产品质量问题-锁体卡顿/弹不出/变形", "2300013615878618,2300012207355512");
        // 安装问题
        faultDetailMap.put("防撬报警", "2300013005091907,2300012207355510");
        faultDetailMap.put("螺丝问题", "2300013005091908,2300012207355510");
        faultDetailMap.put("面板松动", "2300013005091909,2300012207355510");
        faultDetailMap.put("钥匙无法开门", "2300013005091910,2300012207355510");
        faultDetailMap.put("安装问题-其他", "2300013092927184,2300012207355510");
        // 人为问题
        faultDetailMap.put("电池盖坏", "2300013005091911,2300012207355508");
        faultDetailMap.put("电池盒漏液", "2300013005091912,2300012207355508");
        faultDetailMap.put("锁芯盖损坏", "2300013005091913,2300012207355508");
        faultDetailMap.put("刮花/划痕", "2300013005091914,2300012207355508");
        faultDetailMap.put("人为问题-钥匙无法开门", "2300013005091915,2300012207355508");
        faultDetailMap.put("应急电源无法使用", "2300013005091916,2300012207355508");
        faultDetailMap.put("视频指导设置密码", "2300013092729269,2300012207355508");
        faultDetailMap.put("人为问题-其他", "2300013092924516,2300012207355508");
        // 现场问题
        faultDetailMap.put("耗电快（撞击）", "2300013005091917,2300012207355504");
        faultDetailMap.put("不通电（撞击）", "2300013005091919,2300012207355504");
        faultDetailMap.put("门晃动", "2300013005091920,2300012207355504");
        faultDetailMap.put("现场问题-锁体卡顿/弹不出/变形", "2300013005091921,2300012207355504");
        faultDetailMap.put("天地勾卡死", "2300013005091922,2300012207355504");
        faultDetailMap.put("现场问题-其他", "2300013092926762,2300012207355504");
        faultDetailMap.put("锁舌不回弹", "2300013306610082,2300012207355504");
        // 其他
        faultDetailMap.put("其他", "2300013005091923,2300012207355499");
    }

    public static HoubanyunFaultDetailFieldMappingUtil getFaultDetail(String faultDetail) {
        if (StringUtils.isBlank(faultDetail)) {
            return null;
        }
        String faultResonVal = faultDetailMap.get(faultDetail);
        if (StringUtils.isBlank(faultResonVal)) {
            return null;
        }
        String[] faultResonVals = faultResonVal.split(",");
        HoubanyunFaultDetailFieldMappingUtil detail = new HoubanyunFaultDetailFieldMappingUtil();
        detail.setFaultReson(faultResonVals[1]);
        detail.setFaultDetail(faultResonVals[0]);
        return detail;
    }



}
